package com.purdue.edu.psychotron.client.entity;

import java.io.Serializable;

import javax.persistence.Id;

import com.googlecode.objectify.annotation.Entity;

import com.purdue.edu.psychotron.shared.UUID;

@SuppressWarnings("serial")
@Entity
public class BudgetItem extends Item {
        @Id
        private String budgetItemId;
        private String budgetId;
        private String categoryId;
        private Double limit;

        public BudgetItem() {
        }

        public static class Builder {
                private BudgetItem budgetItem;

                public Builder(BudgetItem budgetItem) {
                        this.budgetItem = budgetItem;
                }

                public Builder(String budgetId, String categoryId, Double limit) {
                        this.budgetItem = new BudgetItem();
                        this.budgetItem.budgetItemId = UUID.randomUUID();
                        this.budgetItem.budgetId = budgetId;
                        this.budgetItem.categoryId = categoryId;
                        this.budgetItem.limit = limit;
                }

                public Builder setBudgetId(String budgetId) {
                        this.budgetItem.budgetId = budgetId;
                        return this;
                }

                public Builder setCategoryId(String categoryId) {
                        this.budgetItem.categoryId = categoryId;
                        return this;
                }

                public Builder setLimit(Double limit) {
                        this.budgetItem.limit = limit;
                        return this;
                }

                public BudgetItem build() {
                        return this.budgetItem;
                }
        }

        /* (non-Javadoc)
         * @see edu.purdue.edu.psychotron.client.entity.Item#getBudgetItemId()
         */
        public String getBudgetItemId() {
                return budgetItemId;
        }

        /* (non-Javadoc)
         * @see edu.purdue.edu.psychotron.client.entity.Item#getBudgetId()
         */
        public String getBudgetId() {
                return budgetId;
        }

        /* (non-Javadoc)
         * @see edu.purdue.edu.psychotron.client.entity.Item#getCategoryId()
         */
        public String getCategoryId() {
                return categoryId;
        }

        /* (non-Javadoc)
         * @see edu.purdue.edu.psychotron.client.entity.Item#getLimit()
         */
        public Double getLimit() {
                return limit;
        }
}